{% include "rpgEngine/head.html" %}

<script language="JavaScript" src="{{ MEDIA_URL }}shared/inventory.js">
</script>
<div id="primarycontent">
	<a target="_blank" id="print_link" href="/inventory/print/">print</a>
	<form id="formAddItem" action="/inventory/" method="post">
	<table>
		<tr><td>{{ form.name.label_tag }} :</td>
		    <td>{{ form.name }}</td>
		    <td>{{ form.quantity.label_tag }} :</td>
		    <td>{{ form.quantity }}</td>
		</tr>
		<tr><td td colspan="4">
			<div>{{ form.description }}</div>
		    </td>
		</tr>
		<tr><td td colspan="4" style="text-align:right;"><input type="submit" id="addItem" name="addItem" value="Save" alt="Save Item" /></td>
		</tr>
	</table>
	{{ form.isEdit }}
	</form>
	{% if isError %}
		<p id="errorMessage">Please fill up the name, quantity and description fields properly</p>
	{% endif %}
	
	<div class="inventoryPageSelect">
		{{ pageSelect|safe }}
	</div>

	{% for id, name, description, quantity in items %}
	<div class="inventoryItem" id="{{id}}">
		<div class="header">
			<div class="quantity">
				 {{quantity}}
			</div>
			<span class="name">{{name|safe}}</span>
			 - <a href="/inventory/editItem/{{id}}/"><small>edit</small></a>
			 - <a href="#" onclick="confirmDelete('{{ id }}', '{{ name }}', '{{ beginAt }}')"><small>delete</small></a>
		</div>
		<div class="content">
		{{description|safe}}
		</div>
	</div>
	{% endfor %}
</div>
{% include "rpgEngine/foot.html" %}
